<?php

namespace App\Models;


use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Tymon\JWTAuth\Contracts\JWTSubject;

class Users extends Authenticatable implements JWTSubject
{
    use HasFactory;
    use SoftDeletes;
    protected $guarded = [];

    public function getJWTIdentifier()
    {
        // TODO: Implement getJWTIdentifier() method.
        return $this->getKey();
    }

    public function getJWTCustomClaims()
    {
        // TODO: Implement getJWTCustomClaims() method.
        return [];
    }



    /**
     * 获取与用户相关的学校
     */
    public function school()
    {
        return $this->belongsTo(School::class,'school_id');
    }
    /**
     * 用户所拥有的角色
     */
    public function roles()
    {
        return $this->hasOne(Role::class,'id');
    }

}
